//
//  HomeMsgHeaderVIew.swift
//  NDAi
//
//  Created by 丸子 on 2024/7/17.
//

import UIKit

class HomeMsgHeaderVIew: UIView {
    
    private lazy var backView: UIView = {
       let view = UIView()
        view.backgroundColor = .clear
        view.allRound(8)
        return view
    }()
    
    private lazy var bgIV: UIImageView = {
       let imageView = UIImageView()
        imageView.image = UIImage(named: "icon_home_headbg")
        imageView.contentMode = .scaleToFill
        imageView.clipsToBounds = true
        return imageView
    }()
    
    lazy var headTitleLb: UILabel = {
        let label = UILabel()
        label.font = UIFont.pingFangSCRegular(ofSize: 14)
        label.textColor = UIColor.white
        label.text = "AI智能绘画"
        return label
    }()
    
    lazy var headDescLb: UILabel = {
        let label = UILabel()
        label.font = UIFont.pingFangSCRegular(ofSize: 12)
        label.textColor = UIColor.white.withAlphaComponent(0.7)
        label.text = "科技与艺术的完美结合，AI智能助您画出未来！"
        label.numberOfLines = 2
        return label
    }()
    
     lazy var gotoDarkBtn: UIButton = {
        let button = UIButton(type: .custom)
        button.titleForNormal = "立即体验"
        button.titleFont = UIFont.pingFangSCRegular(ofSize: 12)
        button.backgroundColor = UIColor(hexString: "#FBF1FF")
        button.titleColorForNormal = UIColor(hexString: "#4A2AC6")
        button.allRound(17)
        return button
    }()
    
    lazy var lineView: UIView = {
        let view = UIView()
        view.backgroundColor = Theme.color.main
        view.allRound(3)
        return view
    }()
    
    lazy var titleLb: UILabel = {
        let label = UILabel()
        label.font = UIFont.pingFangSCRegular(ofSize: 15)
        label.textColor = Theme.color.main
        label.text = "更多技能"
        return label
    }()
    
    lazy var descLb: UILabel = {
        let label = UILabel()
        label.font = UIFont.pingFangSCRegular(ofSize: 11)
        label.textColor = Theme.color.text_d3
        label.text = "多种场景自由应答"
        return label
    }()
    
    lazy var moreBtn: UIButton = {
        let button = UIButton(type: .custom)
        button.titleForNormal = "更多"
        button.imageForNormal = UIImage(named: "icon_Mine_更多")
        button.titleColorForNormal = Theme.color.text_d3
        button.titleFont = UIFont.pingFangSCRegular(ofSize: 12)
        return button
    }()
   
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = .clear
        self.addSubviews([backView])
        backView.addSubviews([bgIV,headTitleLb, headDescLb, gotoDarkBtn])
        
        backView.snp.makeConstraints { make in
            make.top.equalTo(10)
            make.leading.trailing.equalToSuperview().inset(15)
            make.height.equalTo(84)
        }
        
        bgIV.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
        
        headTitleLb.snp.makeConstraints { make in
            make.top.equalTo(14)
            make.leading.equalToSuperview().offset(64)
        }
        
        headDescLb.snp.makeConstraints { make in
            make.trailing.equalTo(gotoDarkBtn.snp.leading).offset(-10)
            make.leading.equalToSuperview().offset(64)
            make.top.equalTo(headTitleLb.snp.bottom).offset(2)
        }
        
        gotoDarkBtn.snp.makeConstraints { make in
            make.centerY.equalToSuperview()
            make.trailing.equalToSuperview().offset(-12)
            make.height.equalTo(34)
            make.width.equalTo(83)
        }
         
        self.addSubviews([lineView, titleLb, descLb, moreBtn])
        lineView.snp.makeConstraints { make in
            make.top.equalTo(backView.snp.bottom).offset(16)
            make.leading.equalToSuperview().offset(16)
            make.width.equalTo(6)
            make.height.equalTo(16)
        }
        
        titleLb.snp.makeConstraints { make in
            make.centerY.equalTo(lineView)
            make.leading.equalTo(lineView.snp.trailing).offset(8)
        }
        
        descLb.snp.makeConstraints { make in
            make.bottom.equalTo(titleLb.snp.bottom)
            make.leading.equalTo(titleLb.snp.trailing).offset(5)
        }
        
        moreBtn.snp.makeConstraints { make in
            make.centerY.equalTo(titleLb)
            make.trailing.equalToSuperview().offset(-16)
            make.height.equalTo(30)
        }
        
     
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        moreBtn.layoutButtonWithEdgeInsetsStyle(.Right, space: 4)
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
